import http from './interface'
/**
 * 将业务所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 * 
 */

// 登录
export const login = (data) => {
    return http.request({
        url: '?service=App.Sys_User.AppLogin',
        data,
    })
}

export const loginx = (data) => {
    return http.request({
        url: 'wechat/login',
        data,
    })
}

export const moblie = (data) => {
    return http.request({
        url: 'user/send',
        data,
    })
}



// 新增留言
export const addMsg = (data) => {
    return http.request({
        url: '?service=App.Web_Msg.AddMsg',
        data,
    })
}

// 查询留言
export const getMsg = (data) => {
    return http.request({
        url: '?service=App.Web_Msg.SelectMsg',
        data,
    })
}

// 删除留言
export const deleteMsg = (data) => {
    return http.request({
        url: '?service=App.Sys_Msg.DeleteMsg',
        data,
    })
}

// 查询文章列表
export const SelectArticleList = (data) => {
    return http.request({
        url: '?service=App.Sys_Article.SelectArticle',
        data,
    })
}

// 更新文章状态
export const updataState = (data) => {
    return http.request({
        url: '?service=App.Sys_Article.UpdataState',
        data,
    })
}

// 删除文章
export const deleteArticle = (data) => {
    return http.request({
        url: '?service=App.Sys_Article.DeleteArticle',
        data,
    })
}

// 文章详情
export const articleInfo = (data) => {
    return http.request({
        url: '?service=App.Web_Article.SelectArticleInfo',
        data,
    })
}

// 获取用户列表
export const getAllUser = (data) => {
    return http.request({
        url: '?service=App.Sys_User.GetAllUser',
        data,
    })
}

// 注册用户
export const addUser = (data) => {
    return http.request({
        url: '?service=App.Sys_User.AddUser',
        data,
    })
}

// 删除用户
export const deleteUser = (data) => {
    return http.request({
        url: '?service=App.Sys_User.DeleteUser',
        data,
    })
}

// 修改用户
export const editUser = (data) => {
    return http.request({
        url: '?service=App.Sys_User.EditUser',
        data,
    })
}

// 查询用户邮箱
export const getUserEmail = (data) => {
    return http.request({
        url: '?service=App.Sys_User.GetUserEmail',
        data,
    })
}

// 修改密码
export const editPassword = (data) => {
    return http.request({
        url: '?service=App.Sys_User.EditPassword',
        data,
    })
}

// 发邮件
export const sendEmail = (data) => {
    return http.request({
        url: '?service=App.Examples_PHPMailer.SendMailer',
        data,
    })
}

// 打卡用户表
export const wxGetAllUser = (data) => {
    return http.request({
        url: '?service=App.Wx_WeiXin.GetAllUser',
        data,
    })
}

// 用户打卡记录查询
export const wxGetUserSign = (data) => {
    return http.request({
        url: '?service=App.Wx_WeiXin.GetUserSign',
        data,
    })
}

// 删除打卡记录
export const wxDeleteSign = (data) => {
    return http.request({
        url: '?service=App.Wx_WeiXin.DeleteSign',
        data,
    })
}

// 打卡统计
export const statisticsSign = (data) => {
    return http.request({
        url: '?service=App.Wx_WeiXin.StatisticsSign',
		data,
    })
}

// 统计数据
export const allStatistics = () => {
    return http.request({
        url: '?service=App.Sys_Sys.AllStatistics',
		method: 'GET', 
    })
}

// 查询首页banner配置
export const searchH5Sys = () => {
    return http.request({
        url: '?service=App.Sys_Sys.SearchH5Sys',
		method: 'GET', 
    })
}

// 查询文章所有栏目
export const getColumn = () => {
    return http.request({
        url: '?service=App.Sys_Column.SelectAll',
		method: 'GET', 
    })
}

// 查询文章栏目详情
export const selectColumn = (data) => {
    return http.request({
        url: '?service=App.Sys_Column.SelectColumn',
		data,
    })
}

// 查询所有用户打卡记录
export const selectAllUsersign = (data) =>{
	return http.request({
		url: '?service=App.Wx_WeiXin.SelectAllUsersign',
		data,
	})
}



// 单独导出(测试接口) import {test} from '@/common/vmeitime-http/'
export const text = (data) => {
	http.config.baseUrl = "http://www.ceshi.cn:8071/"
	//设置请求前拦截器
	/* http.interceptor.request = (config) => {
		config.header = {
			"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
		}
	} */
	//设置请求结束后拦截器
	http.interceptor.response = (response) => {
		console.log('个性化response....')
		//判断返回状态 执行相应操作
		return response;
	}
    return http.request({
        url: '?service=App.Sys_User.Login',
		dataType: 'text',
        data,
    })
}

// 轮播图
export const banner = (data) => {
    return http.request({
        url: '/banner/36kr',
        method: 'GET', 
        data,
		// handle:true
    })
}

// 默认全部导出  import api from '@/common/vmeitime-http/'
export default {
	text,
	login,
	loginx,
	moblie,
	addMsg,
	getMsg,
	deleteMsg,
	SelectArticleList,
	updataState,
	deleteArticle,
	articleInfo,
	getAllUser,
	addUser,
	deleteUser,
	editUser,
	getUserEmail,
	editPassword,
	sendEmail,
	wxGetAllUser,
	wxGetUserSign,
	wxDeleteSign,
	searchH5Sys,
	statisticsSign,
	allStatistics,
    banner,
	getColumn,
	selectColumn,
	selectAllUsersign,
}